package com.example.makerspace.controller;


import com.example.makerspace.dto.*;
import com.example.makerspace.service.CampService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Map;

@Controller
@ResponseBody
@RequestMapping("/api/camp")
public class CampController {
    @Resource
    private CampService campService;

    @PostMapping("/bookList")
    public Result bookList(@RequestBody PageRequest pageRequest){
        return campService.bookList(pageRequest);
    }

    @PostMapping("/bookDetail")
    public Result bookDetail(@RequestBody BookChapterDTO bookChapterDTO){
        return campService.bookDetail(bookChapterDTO);
    }

    @PostMapping("/courseList")
    public Result courseList(@RequestBody PageRequest pageRequest){
        return campService.courseList(pageRequest);
    }

    @PostMapping("/courseDetail")
    public Result courseDetail(@RequestBody CourseVideoDTO courseVideoDTO){
        return campService.courseDetail(courseVideoDTO);
    }

    @PostMapping("/examList")
    public Result examList(@RequestBody PageRequest pageRequest){
        return campService.examList(pageRequest);
    }

    @PostMapping("/examDetail")
    public Result examDetail(@RequestBody ExamQuestionDTO examQuestionDTO){
        return campService.examDetail(examQuestionDTO);
    }

    @PostMapping("/examSubmit")
    public Result examSubmit(@RequestBody Map<String, Object> params){
        return campService.examSubmit(params);
    }
}
